package cn.edu.stu.syllabus.library.star;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import javax.inject.Inject;

import cn.edu.stu.syllabus.R;
import cn.edu.stu.syllabus.base.BaseActivity;
import cn.edu.stu.syllabus.utils.ActivityUtils;
import cn.edu.stu.syllabus.utils.GuideHelper;

public class BookStarActivity extends BaseActivity {

    @Inject
    BookStarPresenter mBookStarPresenter;

    @Override
    protected int getContentViewId() {
        return R.layout.activity_book_star;
    }

    @Override
    protected void init(Bundle savedInstanceState) {

        setTitle("我的收藏");

        BookStarFragment bookStarFragment = (BookStarFragment) getSupportFragmentManager()
                .findFragmentById(R.id.contentFrame);
        if (bookStarFragment == null) {
            bookStarFragment = BookStarFragment.newInstance();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(),
                    bookStarFragment, R.id.contentFrame);
        }

        setOnToolbarDoubleClickListener(bookStarFragment);

        DaggerBookStarComponent.builder()
                .bookStarPresenterModule(new BookStarPresenterModule(bookStarFragment))
                .build().inject(this);

        GuideHelper.startActSeqNow(this,
                GuideHelper.getActMainTapTarget(R.drawable.ic_favorite, this,
                        "这是收藏夹界面",
                        "如果你需要取消某个收藏，可以长按item并点击取消。\n" +
                                "底部上拉可以加载更多\n双击Title可以立刻回到顶部")
                        .id(1)
        );
    }

    public static Intent newIntent(Context context) {
        Intent intent = new Intent(context, BookStarActivity.class);
        return intent;
    }
}
